package com.flute.framework.search;

/**
 * 搜索请求信息封装类
 * 
 * @author Dave
 * 
 */
public class SearchRequest {
	/**
	 * 搜索器名称
	 */
	private String searcherName;

	/**
	 * 关键字
	 */
	private SearchKeyword keyword;
	/**
	 * 页数
	 */
	private int pageNumber;
	/**
	 * 每页的记录数
	 */
	private int numberPerPage;
	/**
	 * 排序规则名
	 */
	private String sorterName;

	private SearchFilter searchFilter;
	
	private String client;

	public SearchRequest() {
		this.searchFilter = new SearchFilter();
	}

	public String getKeyword() {
		return keyword.getKeyword();
	}

	public void setKeyword(String keyword) {
		this.keyword = new SearchKeyword(keyword);
	}

	public void setKeyword(SearchKeyword keyword) {
		this.keyword = keyword;
	}

	public SearchKeyword getSearchKeyword() {
		return keyword;
	}

	public int getPageNumber() {
		return pageNumber;
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}

	public int getNumberPerPage() {
		return numberPerPage;
	}

	public void setNumberPerPage(int numberPerPage) {
		this.numberPerPage = numberPerPage;
	}

	public String getSorter() {
		return sorterName;
	}

	public void setSorter(String sorterName) {
		this.sorterName = sorterName;
	}

	public String getSearcherName() {
		return searcherName;
	}

	public void setSearcherName(String searcherName) {
		this.searcherName = searcherName;
	}

	public String toString() {
		if (keyword == null) {
			keyword = new SearchKeyword();
		}

		if (sorterName == null) {
			sorterName = "";
		}

		String bb = "";
		if (searchFilter != null) {
			bb = searchFilter.toString().trim();
		}
		return this.searcherName + ":" + ":" + keyword + ":" + bb + ":"
				+ pageNumber + ":" + numberPerPage + ":" + sorterName;
	}

	public SearchFilter getSearchFilter() {
		return searchFilter;
	}

	public void setSearchFilter(SearchFilter searchFilter) {
		this.searchFilter = searchFilter;
	}

	public String getClient() {
		return client;
	}

	public void setClient(String client) {
		this.client = client;
	}
}
